package com.hhkj.study.admin.resource.excel;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Author luowu
 * @Date 2024/9/24 涵 10:27:29
 */
@Data
public class ResourceCourseLiveExcelRes extends BaseExcelRes {

    /**
     * 名称
     */
    @Excel(name = "名称", width = 20, needMerge = true, require = true)
    @NotBlank(message = "名称不能为空或有误")
    private String name;
    /**
     * 课程小类,字典表中id:备考,练习
     */
    @Excel(name = "课程小类", width = 20, needMerge = true, customDictType = "courseTypeCode", needFilterStr = StrUtil.DASHED, require = true)
    @NotNull(message = "课程小类不能为空或有误")
    private Long courseType;
    /**
     * 直播课类型,字典表中id
     */
    @Excel(name = "类型", width = 20, needMerge = true, customDictType = "liveTypeCode", require = true)
    @NotNull(message = "直播课类型不能为空或有误")
    private Long type;

    /**
     * 直播url
     */
    @NotBlank(message = "直播地址为空或者错误")
    @Excel(name = "直播地址", width = 20, needMerge = true, require = true)
    private String url;

    /**
     * 资料id,关联x_resource_course_doc表中id
     */
    private Long docId;

    @Excel(name = "资料url", width = 20, needMerge = true, type = Excel.Type.EXPORT)
    private String docUrl;

    @Excel(name = "资料名称", width = 20, needMerge = true, type = Excel.Type.IMPORT)
    private String docName;
    /**
     * 题库id,关联x_resource_question_bank表中id
     */
    private Long bankId;

    @Excel(name = "题库名称", width = 20, needMerge = true)
    private String bankName;
    /**
     * 年份
     */
    private String year;
    /**
     * 讲师id,关联x_teacher表中id
     */
    private Long teacherId;

    @NotBlank(message = "讲师不能为空或有误")
    @Excel(name = "讲师", width = 20, needMerge = true, require = true)
    private String teacherName;
    /**
     * 是否有回放 0-否 1-是
     */
    private Integer playbackFlag;
    /**
     * 视频id,关联x_resource_course_video表中id
     */
    private Long videoId;

    @Excel(name = "开始结束时间", width = 20, needMerge = true, type = Excel.Type.EXPORT)
    private String startEndTime;
    /**
     * 开始时间
     */
    @NotNull(message = "开始时间不能为空或有误")
    @Excel(name = "开始时间", width = 20, needMerge = true, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.IMPORT, require = true)
    private Date startTime;
    /**
     * 结束时间
     */
    @NotNull(message = "结束时间不能为空或有误")
    @Excel(name = "结束时间", width = 20, needMerge = true, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.IMPORT, require = true)
    private Date endTime;
    /**
     * 说明
     */
    private String remark;
    /**
     * 是否展示（0-上架， 1-下架）
     */
    @Excel(name = "上下架状态", width = 20, needMerge = true, readConverterExp = "0=否,1=是" ,require = true, combo = {"是","否"})
    @NotNull(message = "上下架状态不能为空或有误")
    private Integer publishedFlag;
    /**
     * 排序序号
     */
    private Integer orderNum;

    @Override
    public Long getResourceCourseType() {
        return this.courseType;
    }

    @Override
    public String getTitle() {
        return "直播导入模板\n" +
                "1、表头红色加粗为必填字段\n" +
                "2、开始/结束时间格式为yyyy-MM-dd HH:mm:ss\n" +
                "3、资料/题库名称要和已有数据一致,相同课程类型的名称栏不能和已有的重复\n";
    }

    @Override
    public String getSheetName() {
        return "直播导入模板";
    }
}
